# -*- coding: utf-8 -*-

"""
@author: 猿小天
@contact: QQ:1638245306
@Created on: 2021/6/1 001 23:05
@Remark: 系统管理的路由文件
"""
from django.urls import path

from super.system.views.area import AreaViewSet
from super.system.views.button import ButtonViewSet
from super.system.views.dept import DeptViewSet
from super.system.views.dictionary import DictionaryViewSet
from super.system.views.file_list import FileViewSet
from super.system.views.img_list import ImgViewSet
from super.system.views.menu import MenuViewSet
from super.system.views.menu_button import MenuButtonViewSet
from super.system.views.operation_log import OperationLogViewSet
from super.system.views.role import RoleViewSet
from super.system.views.user import UserViewSet
from super.system.views.form import FormViewSet
from super.system.routes import router
from rest_framework.permissions import IsAuthenticated

app_name = 'super.system'
router.register(r'menu', MenuViewSet)
router.register(r'form', FormViewSet)
router.register(r'button', ButtonViewSet)
router.register(r'menu_button', MenuButtonViewSet)
router.register(r'role', RoleViewSet)
router.register(r'dept', DeptViewSet)
router.register(r'user', UserViewSet)
router.register(r'operation_log', OperationLogViewSet)
router.register(r'dictionary', DictionaryViewSet)
router.register(r'area', AreaViewSet)
router.register(r'img', ImgViewSet)
router.register(r'file', FileViewSet)

urlpatterns = [
    path('role/role_id_to_menu/<str:pk>/',
         RoleViewSet.as_view({'get': 'roleId_to_menu'}, permission_classes=[IsAuthenticated])),
    path('menu/web_router/', MenuViewSet.as_view({'get': 'web_router'}, permission_classes=[IsAuthenticated])),
    path('user/user_info/',
         UserViewSet.as_view({'get': 'user_info', 'put': 'update_user_info'}, permission_classes=[IsAuthenticated])),
    path('user/change_password/<str:pk>/',
         UserViewSet.as_view({'put': 'change_password'}, permission_classes=[IsAuthenticated]),),
]
urlpatterns += router.urls
